package light.mvc.controller.record;

import light.mvc.controller.base.BaseController;
import light.mvc.pageModel.base.Grid;
import light.mvc.pageModel.base.PageFilter;
import light.mvc.pageModel.record.Project;
import light.mvc.service.record.ProjectServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping( { "/project" })
public class ProjectController extends BaseController {
	@Autowired
	private ProjectServiceI projectService;

	@RequestMapping( { "/record" })
	public String manager() {
		return "/record/project";
	}

	@RequestMapping( { "/dataGrid" })
	@ResponseBody
	public Grid dataGrid(Project project, PageFilter ph) {
		Grid grid = new Grid();
		grid.setRows(this.projectService.dataGrid(project, ph));
		grid.setTotal(this.projectService.count(project, ph));
		return grid;
	}
}
